package engine.logic.login
{
	import engine.logic.loading.LoadingLogic;
	
	import newx.com.config.StaticIni;
	import newx.utils.debug.IO;

	public class WaitingForScene
	{
		public function WaitingForScene()
		{
		}
		static private var _self:WaitingForScene;
		
		static private var _time:NxTimer=	new NxTimer();
		
		static private var _timeCount:Number=0;
		
		static public function start():void
		{	
			LoadingLogic.getInstance().setProcess(_timeCount,StaticIni.getSwfLangStr("UIStr_1001055"));
			_time.timingCall(waitingAni,null,100,0,true);
//			if(null		==	_self)
//					_self	=	new WaitingForScene();
//			
//			_self.start();
		}
		
		static public function end():void
		{
			IO.traceLog("场景进度条关闭end");
			LoadingLogic.getInstance().setProcess(100,StaticIni.getSwfLangStr("UIStr_1001055"));
			IO.traceLog("场景进度条执行关闭OK");
			_time.stop();
			_timeCount=0;
			LoadingLogic.getInstance().nxLoading.y	=	0;
//			if(null		==	_self)
//				return;
//			
//			_self.end();			
		}
		
//		private function start():void
//		{
//			LoadingLogic.getInstance().setProcess(_timeCount,StaticIni.getSwfLangStr("UIStr_1001055"));
//			_time.timingCall(waitingAni,null,100,0,true);
//		}
//		
//		private function end():void
//		{
//			LoadingLogic.getInstance().setProcess(100,StaticIni.getSwfLangStr("UIStr_1001055"));
//			_time.stop();
//			_timeCount=0;
//			LoadingLogic.getInstance().nxLoading.y	=	0;
//		}
		
		static private function waitingAni(param:Array=null):void
		{	
			//修改为无限接近100%，但是永远到不了
			if( _timeCount < 30 )
			{
				_timeCount += 1.5;
			}else if( _timeCount < 50 )
			{
				_timeCount += 0.5;
			}else if( _timeCount < 80 )
			{
				_timeCount += .3;
			}else if( _timeCount < 99 )
			{
				_timeCount += .05;
			}else
			{
				_timeCount = 99;
			}
			LoadingLogic.getInstance().setProcess(int(_timeCount),StaticIni.getSwfLangStr("UIStr_1001055"));
		}
	}
}